Skip to content

Fix and test async def linenos#198

Merged
Erotemic merged 2 commits into
mainfrom
fix-async-lineno
Mar 25, 2026
Merged

Fix and test async def linenos#198
Erotemic merged 2 commits into
mainfrom
fix-async-lineno

Conversation

@Erotemic

Copy link
Copy Markdown
Owner

Fixes #197 it looks like the old workaround function TopLevelVisitor._workaround_func_lineno is safe to remove.

The old AST bug where decorated defs/classes reported the decorator line instead of the def/class line was fixed in CPython bpo-33211, closed 2018-11-23 and I think landed in 3.7 and 3.8. (python/cpython#77392)

For PyPy I don't have direct evidence, but coveragepy has a note indicating that PyPy 3.8 has the bug, but it is fixed in PyPy 3.9 v7.3.8rc1 (https://github.com/coveragepy/coveragepy/blob/master/lab/notes/pypy-738-decorated-functions.txt), so its probably safe enough to land it here.

If anyone is on an older pypy, using xdoctest, and encounters this error, then I suppose make an issue.

@Erotemic Erotemic merged commit 8d25c47 into main Mar 25, 2026
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decorators on async functions causes xdoctest to crash

1 participant